package com.geetour.columbus.admin.bo.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.geetour.columbus.admin.bo.IAdminBO;
import com.geetour.columbus.admin.dao.IAdminDAO;
import com.geetour.columbus.common.model.A.Admin;

@Service
public class AdminBOImpl implements IAdminBO {

    private IAdminDAO adminDAOImpl;

    @Autowired
    public void setAdminDAOImpl(IAdminDAO adminDAOImpl) {
        this.adminDAOImpl = adminDAOImpl;
    }

    @Override
    public Admin getAdminByName(String name) {
        if (name == null) {
            return null;
        }
        Admin admin = new Admin();
        admin.setName(name);
        List<Admin> list = adminDAOImpl.getAdmins(admin);
        if (list == null || list.isEmpty()) {
            return null;
        }
        return list.get(0);
    }

    @Override
    public int updateModifyDate(String uuid) {
        if (uuid == null) {
            return -1;
        }
        return adminDAOImpl.updateModifydate(uuid);
    }

}
